home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / g / gnu_c / info.lzh / INFO / GCC_INFO.10 < prev    next >
Encoding:
GNU Info File  |  1993-10-21  |  40.3 KB  |  958 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.  
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.  
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided also
  14. that the sections entitled "GNU General Public License" and "Protect
  15. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  16. original, and provided that the entire resulting derived work is
  17. distributed under the terms of a permission notice identical to this
  18. one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that the sections entitled "GNU General Public
  23. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  24. permission notice, may be included in translations approved by the Free
  25. Software Foundation instead of in the original English.
  26.  
  27. File: gcc.info,  Node: Machine Modes,  Next: Constants,  Prev: Flags,  Up: RTL
  28.  
  29. Machine Modes
  30. =============
  31.  
  32.    A machine mode describes a size of data object and the
  33. representation used for it.  In the C code, machine modes are
  34. represented by an enumeration type, `enum machine_mode', defined in
  35. `machmode.def'.  Each RTL expression has room for a machine mode and so
  36. do certain kinds of tree expressions (declarations and types, to be
  37. precise).
  38.  
  39.    In debugging dumps and machine descriptions, the machine mode of an
  40. RTL expression is written after the expression code with a colon to
  41. separate them.  The letters `mode' which appear at the end of each
  42. machine mode name are omitted.  For example, `(reg:SI 38)' is a `reg'
  43. expression with machine mode `SImode'.  If the mode is `VOIDmode', it
  44. is not written at all.
  45.  
  46.    Here is a table of machine modes.  The term "byte" below refers to an
  47. object of `BITS_PER_UNIT' bits (*note Storage Layout::.).
  48.  
  49. `QImode'
  50.      "Quarter-Integer" mode represents a single byte treated as an
  51.      integer.
  52.  
  53. `HImode'
  54.      "Half-Integer" mode represents a two-byte integer.
  55.  
  56. `PSImode'
  57.      "Partial Single Integer" mode represents an integer which occupies
  58.      four bytes but which doesn't really use all four.  On some
  59.      machines, this is the right mode to use for pointers.
  60.  
  61. `SImode'
  62.      "Single Integer" mode represents a four-byte integer.
  63.  
  64. `PDImode'
  65.      "Partial Double Integer" mode represents an integer which occupies
  66.      eight bytes but which doesn't really use all eight.  On some
  67.      machines, this is the right mode to use for certain pointers.
  68.  
  69. `DImode'
  70.      "Double Integer" mode represents an eight-byte integer.
  71.  
  72. `TImode'
  73.      "Tetra Integer" (?) mode represents a sixteen-byte integer.
  74.  
  75. `SFmode'
  76.      "Single Floating" mode represents a single-precision (four byte)
  77.      floating point number.
  78.  
  79. `DFmode'
  80.      "Double Floating" mode represents a double-precision (eight byte)
  81.      floating point number.
  82.  
  83. `XFmode'
  84.      "Extended Floating" mode represents a triple-precision (twelve
  85.      byte) floating point number.  This mode is used for IEEE extended
  86.      floating point.
  87.  
  88. `TFmode'
  89.      "Tetra Floating" mode represents a quadruple-precision (sixteen
  90.      byte) floating point number.
  91.  
  92. `CCmode'
  93.      "Condition Code" mode represents the value of a condition code,
  94.      which is a machine-specific set of bits used to represent the
  95.      result of a comparison operation.  Other machine-specific modes
  96.      may also be used for the condition code.  These modes are not used
  97.      on machines that use `cc0' (see *note Condition Code::.).
  98.  
  99. `BLKmode'
  100.      "Block" mode represents values that are aggregates to which none of
  101.      the other modes apply.  In RTL, only memory references can have
  102.      this mode, and only if they appear in string-move or vector
  103.      instructions.  On machines which have no such instructions,
  104.      `BLKmode' will not appear in RTL.
  105.  
  106. `VOIDmode'
  107.      Void mode means the absence of a mode or an unspecified mode.  For
  108.      example, RTL expressions of code `const_int' have mode `VOIDmode'
  109.      because they can be taken to have whatever mode the context
  110.      requires.  In debugging dumps of RTL, `VOIDmode' is expressed by
  111.      the absence of any mode.
  112.  
  113. `SCmode, DCmode, XCmode, TCmode'
  114.      These modes stand for a complex number represented as a pair of
  115.      floating point values.  The values are in `SFmode', `DFmode',
  116.      `XFmode', and `TFmode', respectively.  Since C does not support
  117.      complex numbers, these machine modes are only partially
  118.      implemented.
  119.  
  120.    The machine description defines `Pmode' as a C macro which expands
  121. into the machine mode used for addresses.  Normally this is the mode
  122. whose size is `BITS_PER_WORD', `SImode' on 32-bit machines.
  123.  
  124.    The only modes which a machine description must support are
  125. `QImode', and the modes corresponding to `BITS_PER_WORD',
  126. `FLOAT_TYPE_SIZE' and `DOUBLE_TYPE_SIZE'.  The compiler will attempt to
  127. use `DImode' for 8-byte structures and unions, but this can be
  128. prevented by overriding the definition of `MAX_FIXED_MODE_SIZE'.
  129. Alternatively, you can have the compiler use `TImode' for 16-byte
  130. structures and unions.  Likewise, you can arrange for the C type `short
  131. int' to avoid using `HImode'.
  132.  
  133.    Very few explicit references to machine modes remain in the compiler
  134. and these few references will soon be removed.  Instead, the machine
  135. modes are divided into mode classes.  These are represented by the
  136. enumeration type `enum mode_class' defined in `machmode.h'.  The
  137. possible mode classes are:
  138.  
  139. `MODE_INT'
  140.      Integer modes.  By default these are `QImode', `HImode', `SImode',
  141.      `DImode', and `TImode'.
  142.  
  143. `MODE_PARTIAL_INT'
  144.      The "partial integer" modes, `PSImode' and `PDImode'.
  145.  
  146. `MODE_FLOAT'
  147.      floating point modes.  By default these are `SFmode', `DFmode',
  148.      `XFmode' and `TFmode'.
  149.  
  150. `MODE_COMPLEX_INT'
  151.      Complex integer modes.  (These are not currently implemented).
  152.  
  153. `MODE_COMPLEX_FLOAT'
  154.      Complex floating point modes.  By default these are `SCmode',
  155.      `DCmode', `XCmode', and `TCmode'.
  156.  
  157. `MODE_FUNCTION'
  158.      Algol or Pascal function variables including a static chain.
  159.      (These are not currently implemented).
  160.  
  161. `MODE_CC'
  162.      Modes representing condition code values.  These are `CCmode' plus
  163.      any modes listed in the `EXTRA_CC_MODES' macro.  *Note Jump
  164.      Patterns::, also see *Note Condition Code::.
  165.  
  166. `MODE_RANDOM'
  167.      This is a catchall mode class for modes which don't fit into the
  168.      above classes.  Currently `VOIDmode' and `BLKmode' are in
  169.      `MODE_RANDOM'.
  170.  
  171.    Here are some C macros that relate to machine modes:
  172.  
  173. `GET_MODE (X)'
  174.      Returns the machine mode of the RTX X.
  175.  
  176. `PUT_MODE (X, NEWMODE)'
  177.      Alters the machine mode of the RTX X to be NEWMODE.
  178.  
  179. `NUM_MACHINE_MODES'
  180.      Stands for the number of machine modes available on the target
  181.      machine.  This is one greater than the largest numeric value of any
  182.      machine mode.
  183.  
  184. `GET_MODE_NAME (M)'
  185.      Returns the name of mode M as a string.
  186.  
  187. `GET_MODE_CLASS (M)'
  188.      Returns the mode class of mode M.
  189.  
  190. `GET_MODE_WIDER_MODE (M)'
  191.      Returns the next wider natural mode.  For example, the macro
  192.      `GET_WIDER_MODE(QImode)' returns `HImode'.
  193.  
  194. `GET_MODE_SIZE (M)'
  195.      Returns the size in bytes of a datum of mode M.
  196.  
  197. `GET_MODE_BITSIZE (M)'
  198.      Returns the size in bits of a datum of mode M.
  199.  
  200. `GET_MODE_MASK (M)'
  201.      Returns a bitmask containing 1 for all bits in a word that fit
  202.      within mode M.  This macro can only be used for modes whose
  203.      bitsize is less than or equal to `HOST_BITS_PER_INT'.
  204.  
  205. `GET_MODE_ALIGNMENT (M))'
  206.      Return the required alignment, in bits, for an object of mode M.
  207.  
  208. `GET_MODE_UNIT_SIZE (M)'
  209.      Returns the size in bytes of the subunits of a datum of mode M.
  210.      This is the same as `GET_MODE_SIZE' except in the case of complex
  211.      modes.  For them, the unit size is the size of the real or
  212.      imaginary part.
  213.  
  214. `GET_MODE_NUNITS (M)'
  215.      Returns the number of units contained in a mode, i.e.,
  216.      `GET_MODE_SIZE' divided by `GET_MODE_UNIT_SIZE'.
  217.  
  218. `GET_CLASS_NARROWEST_MODE (C)'
  219.      Returns the narrowest mode in mode class C.
  220.  
  221.    The global variables `byte_mode' and `word_mode' contain modes whose
  222. classes are `MODE_INT' and whose bitsizes are either `BITS_PER_UNIT' or
  223. `BITS_PER_WORD', respectively.  On 32-bit machines, these are `QImode'
  224. and `SImode', respectively.
  225.  
  226. File: gcc.info,  Node: Constants,  Next: Regs and Memory,  Prev: Machine Modes,  Up: RTL
  227.  
  228. Constant Expression Types
  229. =========================
  230.  
  231.    The simplest RTL expressions are those that represent constant
  232. values.
  233.  
  234. `(const_int I)'
  235.      This type of expression represents the integer value I.  I is
  236.      customarily accessed with the macro `INTVAL' as in `INTVAL (EXP)',
  237.      which is equivalent to `XWINT (EXP, 0)'.
  238.  
  239.      There is only one expression object for the integer value zero; it
  240.      is the value of the variable `const0_rtx'.  Likewise, the only
  241.      expression for integer value one is found in `const1_rtx', the only
  242.      expression for integer value two is found in `const2_rtx', and the
  243.      only expression for integer value negative one is found in
  244.      `constm1_rtx'.  Any attempt to create an expression of code
  245.      `const_int' and value zero, one, two or negative one will return
  246.      `const0_rtx', `const1_rtx', `const2_rtx' or `constm1_rtx' as
  247.      appropriate.
  248.  
  249.      Similarly, there is only one object for the integer whose value is
  250.      `STORE_FLAG_VALUE'.  It is found in `const_true_rtx'.  If
  251.      `STORE_FLAG_VALUE' is one, `const_true_rtx' and `const1_rtx' will
  252.      point to the same object.  If `STORE_FLAG_VALUE' is -1,
  253.      `const_true_rtx' and `constm1_rtx' will point to the same object.
  254.  
  255. `(const_double:M ADDR I0 I1 ...)'
  256.      Represents either a floating-point constant of mode M or an
  257.      integer constant too large to fit into `HOST_BITS_PER_WIDE_INT'
  258.      bits but small enough to fit within twice that number of bits (GNU
  259.      CC does not provide a mechanism to represent even larger
  260.      constants).  In the latter case, M will be `VOIDmode'.
  261.  
  262.      ADDR is used to contain the `mem' expression that corresponds to
  263.      the location in memory that at which the constant can be found.  If
  264.      it has not been allocated a memory location, but is on the chain
  265.      of all `const_double' expressions in this compilation (maintained
  266.      using an undisplayed field), ADDR contains `const0_rtx'.  If it is
  267.      not on the chain, ADDR contains `cc0_rtx'.  ADDR is customarily
  268.      accessed with the macro `CONST_DOUBLE_MEM' and the chain field via
  269.      `CONST_DOUBLE_CHAIN'.
  270.  
  271.      If M is `VOIDmode', the bits of the value are stored in I0 and I1.
  272.      I0 is customarily accessed with the macro `CONST_DOUBLE_LOW' and
  273.      I1 with `CONST_DOUBLE_HIGH'.
  274.  
  275.      If the constant is floating point (regardless of its precision),
  276.      then the number of integers used to store the value depends on the
  277.      size of `REAL_VALUE_TYPE' (*note Cross-compilation::.).  The
  278.      integers represent a floating point number, but not precisely in
  279.      the target machine's or host machine's floating point format.  To
  280.      convert them to the precise bit pattern used by the target
  281.      machine, use the macro `REAL_VALUE_TO_TARGET_DOUBLE' and friends
  282.      (*note Data Output::.).
  283.  
  284.      The macro `CONST0_RTX (MODE)' refers to an expression with value 0
  285.      in mode MODE.  If mode MODE is of mode class `MODE_INT', it
  286.      returns `const0_rtx'.  Otherwise, it returns a `CONST_DOUBLE'
  287.      expression in mode MODE.  Similarly, the macro `CONST1_RTX (MODE)'
  288.      refers to an expression with value 1 in mode MODE and similarly
  289.      for `CONST2_RTX'.
  290.  
  291. `(const_string STR)'
  292.      Represents a constant string with value STR.  Currently this is
  293.      used only for insn attributes (*note Insn Attributes::.) since
  294.      constant strings in C are placed in memory.
  295.  
  296. `(symbol_ref:MODE SYMBOL)'
  297.      Represents the value of an assembler label for data.  SYMBOL is a
  298.      string that describes the name of the assembler label.  If it
  299.      starts with a `*', the label is the rest of SYMBOL not including
  300.      the `*'.  Otherwise, the label is SYMBOL, usually prefixed with
  301.      `_'.
  302.  
  303.      The `symbol_ref' contains a mode, which is usually `Pmode'.
  304.      Usually that is the only mode for which a symbol is directly valid.
  305.  
  306. `(label_ref LABEL)'
  307.      Represents the value of an assembler label for code.  It contains
  308.      one operand, an expression, which must be a `code_label' that
  309.      appears in the instruction sequence to identify the place where
  310.      the label should go.
  311.  
  312.      The reason for using a distinct expression type for code label
  313.      references is so that jump optimization can distinguish them.
  314.  
  315. `(const:M EXP)'
  316.      Represents a constant that is the result of an assembly-time
  317.      arithmetic computation.  The operand, EXP, is an expression that
  318.      contains only constants (`const_int', `symbol_ref' and `label_ref'
  319.      expressions) combined with `plus' and `minus'.  However, not all
  320.      combinations are valid, since the assembler cannot do arbitrary
  321.      arithmetic on relocatable symbols.
  322.  
  323.      M should be `Pmode'.
  324.  
  325. `(high:M EXP)'
  326.      Represents the high-order bits of EXP, usually a `symbol_ref'.
  327.      The number of bits is machine-dependent and is normally the number
  328.      of bits specified in an instruction that initializes the high
  329.      order bits of a register.  It is used with `lo_sum' to represent
  330.      the typical two-instruction sequence used in RISC machines to
  331.      reference a global memory location.
  332.  
  333.      M should be `Pmode'.
  334.  
  335. File: gcc.info,  Node: Regs and Memory,  Next: Arithmetic,  Prev: Constants,  Up: RTL
  336.  
  337. Registers and Memory
  338. ====================
  339.  
  340.    Here are the RTL expression types for describing access to machine
  341. registers and to main memory.
  342.  
  343. `(reg:M N)'
  344.      For small values of the integer N (those that are less than
  345.      `FIRST_PSEUDO_REGISTER'), this stands for a reference to machine
  346.      register number N: a "hard register".  For larger values of N, it
  347.      stands for a temporary value or "pseudo register".  The compiler's
  348.      strategy is to generate code assuming an unlimited number of such
  349.      pseudo registers, and later convert them into hard registers or
  350.      into memory references.
  351.  
  352.      M is the machine mode of the reference.  It is necessary because
  353.      machines can generally refer to each register in more than one
  354.      mode.  For example, a register may contain a full word but there
  355.      may be instructions to refer to it as a half word or as a single
  356.      byte, as well as instructions to refer to it as a floating point
  357.      number of various precisions.
  358.  
  359.      Even for a register that the machine can access in only one mode,
  360.      the mode must always be specified.
  361.  
  362.      The symbol `FIRST_PSEUDO_REGISTER' is defined by the machine
  363.      description, since the number of hard registers on the machine is
  364.      an invariant characteristic of the machine.  Note, however, that
  365.      not all of the machine registers must be general registers.  All
  366.      the machine registers that can be used for storage of data are
  367.      given hard register numbers, even those that can be used only in
  368.      certain instructions or can hold only certain types of data.
  369.  
  370.      A hard register may be accessed in various modes throughout one
  371.      function, but each pseudo register is given a natural mode and is
  372.      accessed only in that mode.  When it is necessary to describe an
  373.      access to a pseudo register using a nonnatural mode, a `subreg'
  374.      expression is used.
  375.  
  376.      A `reg' expression with a machine mode that specifies more than
  377.      one word of data may actually stand for several consecutive
  378.      registers.  If in addition the register number specifies a
  379.      hardware register, then it actually represents several consecutive
  380.      hardware registers starting with the specified one.
  381.  
  382.      Each pseudo register number used in a function's RTL code is
  383.      represented by a unique `reg' expression.
  384.  
  385.      Some pseudo register numbers, those within the range of
  386.      `FIRST_VIRTUAL_REGISTER' to `LAST_VIRTUAL_REGISTER' only appear
  387.      during the RTL generation phase and are eliminated before the
  388.      optimization phases.  These represent locations in the stack frame
  389.      that cannot be determined until RTL generation for the function
  390.      has been completed.  The following virtual register numbers are
  391.      defined:
  392.  
  393.     `VIRTUAL_INCOMING_ARGS_REGNUM'
  394.           This points to the first word of the incoming arguments
  395.           passed on the stack.  Normally these arguments are placed
  396.           there by the caller, but the callee may have pushed some
  397.           arguments that were previously passed in registers.
  398.  
  399.           When RTL generation is complete, this virtual register is
  400.           replaced by the sum of the register given by
  401.           `ARG_POINTER_REGNUM' and the value of `FIRST_PARM_OFFSET'.
  402.  
  403.     `VIRTUAL_STACK_VARS_REGNUM'
  404.           If `FRAME_GROWS_DOWNWARDS' is defined, this points to
  405.           immediately above the first variable on the stack.
  406.           Otherwise, it points to the first variable on the stack.
  407.  
  408.           `VIRTUAL_STACK_VARS_REGNUM' is replaced with the sum of the
  409.           register given by `FRAME_POINTER_REGNUM' and the value
  410.           `STARTING_FRAME_OFFSET'.
  411.  
  412.     `VIRTUAL_STACK_DYNAMIC_REGNUM'
  413.           This points to the location of dynamically allocated memory
  414.           on the stack immediately after the stack pointer has been
  415.           adjusted by the amount of memory desired.
  416.  
  417.           This virtual register is replaced by the sum of the register
  418.           given by `STACK_POINTER_REGNUM' and the value
  419.           `STACK_DYNAMIC_OFFSET'.
  420.  
  421.     `VIRTUAL_OUTGOING_ARGS_REGNUM'
  422.           This points to the location in the stack at which outgoing
  423.           arguments should be written when the stack is pre-pushed
  424.           (arguments pushed using push insns should always use
  425.           `STACK_POINTER_REGNUM').
  426.  
  427.           This virtual register is replaced by the sum of the register
  428.           given by `STACK_POINTER_REGNUM' and the value
  429.           `STACK_POINTER_OFFSET'.
  430.  
  431. `(subreg:M REG WORDNUM)'
  432.      `subreg' expressions are used to refer to a register in a machine
  433.      mode other than its natural one, or to refer to one register of a
  434.      multi-word `reg' that actually refers to several registers.
  435.  
  436.      Each pseudo-register has a natural mode.  If it is necessary to
  437.      operate on it in a different mode--for example, to perform a
  438.      fullword move instruction on a pseudo-register that contains a
  439.      single byte--the pseudo-register must be enclosed in a `subreg'.
  440.      In such a case, WORDNUM is zero.
  441.  
  442.      Usually M is at least as narrow as the mode of REG, in which case
  443.      it is restricting consideration to only the bits of REG that are
  444.      in M.  However, sometimes M is wider than the mode of REG.  These
  445.      `subreg' expressions are often called "paradoxical".  They are
  446.      used in cases where we want to refer to an object in a wider mode
  447.      but do not care what value the additional bits have.  The reload
  448.      pass ensures that paradoxical references are only made to hard
  449.      registers.
  450.  
  451.      The other use of `subreg' is to extract the individual registers of
  452.      a multi-register value.  Machine modes such as `DImode' and
  453.      `TImode' can indicate values longer than a word, values which
  454.      usually require two or more consecutive registers.  To access one
  455.      of the registers, use a `subreg' with mode `SImode' and a WORDNUM
  456.      that says which register.
  457.  
  458.      The compilation parameter `WORDS_BIG_ENDIAN', if set to 1, says
  459.      that word number zero is the most significant part; otherwise, it
  460.      is the least significant part.
  461.  
  462.      Between the combiner pass and the reload pass, it is possible to
  463.      have a paradoxical `subreg' which contains a `mem' instead of a
  464.      `reg' as its first operand.  After the reload pass, it is also
  465.      possible to have a non-paradoxical `subreg' which contains a
  466.      `mem'; this usually occurs when the `mem' is a stack slot which
  467.      replaced a pseudo register.
  468.  
  469.      Note that it is not valid to access a `DFmode' value in `SFmode'
  470.      using a `subreg'.  On some machines the most significant part of a
  471.      `DFmode' value does not have the same format as a single-precision
  472.      floating value.
  473.  
  474.      It is also not valid to access a single word of a multi-word value
  475.      in a hard register when less registers can hold the value than
  476.      would be expected from its size.  For example, some 32-bit
  477.      machines have floating-point registers that can hold an entire
  478.      `DFmode' value.  If register 10 were such a register `(subreg:SI
  479.      (reg:DF 10) 1)' would be invalid because there is no way to
  480.      convert that reference to a single machine register.  The reload
  481.      pass prevents `subreg' expressions such as these from being formed.
  482.  
  483.      The first operand of a `subreg' expression is customarily accessed
  484.      with the `SUBREG_REG' macro and the second operand is customarily
  485.      accessed with the `SUBREG_WORD' macro.
  486.  
  487. `(scratch:M)'
  488.      This represents a scratch register that will be required for the
  489.      execution of a single instruction and not used subsequently.  It is
  490.      converted into a `reg' by either the local register allocator or
  491.      the reload pass.
  492.  
  493.      `scratch' is usually present inside a `clobber' operation (*note
  494.      Side Effects::.).
  495.  
  496. `(cc0)'
  497.      This refers to the machine's condition code register.  It has no
  498.      operands and may not have a machine mode.  There are two ways to
  499.      use it:
  500.  
  501.         * To stand for a complete set of condition code flags.  This is
  502.           best on most machines, where each comparison sets the entire
  503.           series of flags.
  504.  
  505.           With this technique, `(cc0)' may be validly used in only two
  506.           contexts: as the destination of an assignment (in test and
  507.           compare instructions) and in comparison operators comparing
  508.           against zero (`const_int' with value zero; that is to say,
  509.           `const0_rtx').
  510.  
  511.         * To stand for a single flag that is the result of a single
  512.           condition.  This is useful on machines that have only a
  513.           single flag bit, and in which comparison instructions must
  514.           specify the condition to test.
  515.  
  516.           With this technique, `(cc0)' may be validly used in only two
  517.           contexts: as the destination of an assignment (in test and
  518.           compare instructions) where the source is a comparison
  519.           operator, and as the first operand of `if_then_else' (in a
  520.           conditional branch).
  521.  
  522.      There is only one expression object of code `cc0'; it is the value
  523.      of the variable `cc0_rtx'.  Any attempt to create an expression of
  524.      code `cc0' will return `cc0_rtx'.
  525.  
  526.      Instructions can set the condition code implicitly.  On many
  527.      machines, nearly all instructions set the condition code based on
  528.      the value that they compute or store.  It is not necessary to
  529.      record these actions explicitly in the RTL because the machine
  530.      description includes a prescription for recognizing the
  531.      instructions that do so (by means of the macro
  532.      `NOTICE_UPDATE_CC').  *Note Condition Code::.  Only instructions
  533.      whose sole purpose is to set the condition code, and instructions
  534.      that use the condition code, need mention `(cc0)'.
  535.  
  536.      On some machines, the condition code register is given a register
  537.      number and a `reg' is used instead of `(cc0)'.  This is usually the
  538.      preferable approach if only a small subset of instructions modify
  539.      the condition code.  Other machines store condition codes in
  540.      general registers; in such cases a pseudo register should be used.
  541.  
  542.      Some machines, such as the Sparc and RS/6000, have two sets of
  543.      arithmetic instructions, one that sets and one that does not set
  544.      the condition code.  This is best handled by normally generating
  545.      the instruction that does not set the condition code, and making a
  546.      pattern that both performs the arithmetic and sets the condition
  547.      code register (which would not be `(cc0)' in this case).  For
  548.      examples, search for `addcc' and `andcc' in `sparc.md'.
  549.  
  550. `(pc)'
  551.      This represents the machine's program counter.  It has no operands
  552.      and may not have a machine mode.  `(pc)' may be validly used only
  553.      in certain specific contexts in jump instructions.
  554.  
  555.      There is only one expression object of code `pc'; it is the value
  556.      of the variable `pc_rtx'.  Any attempt to create an expression of
  557.      code `pc' will return `pc_rtx'.
  558.  
  559.      All instructions that do not jump alter the program counter
  560.      implicitly by incrementing it, but there is no need to mention
  561.      this in the RTL.
  562.  
  563. `(mem:M ADDR)'
  564.      This RTX represents a reference to main memory at an address
  565.      represented by the expression ADDR.  M specifies how large a unit
  566.      of memory is accessed.
  567.  
  568. File: gcc.info,  Node: Arithmetic,  Next: Comparisons,  Prev: Regs and Memory,  Up: RTL
  569.  
  570. RTL Expressions for Arithmetic
  571. ==============================
  572.  
  573.    Unless otherwise specified, all the operands of arithmetic
  574. expressions must be valid for mode M.  An operand is valid for mode M
  575. if it has mode M, or if it is a `const_int' or `const_double' and M is
  576. a mode of class `MODE_INT'.
  577.  
  578.    For commutative binary operations, constants should be placed in the
  579. second operand.
  580.  
  581. `(plus:M X Y)'
  582.      Represents the sum of the values represented by X and Y carried
  583.      out in machine mode M.
  584.  
  585. `(lo_sum:M X Y)'
  586.      Like `plus', except that it represents that sum of X and the
  587.      low-order bits of Y.  The number of low order bits is
  588.      machine-dependent but is normally the number of bits in a `Pmode'
  589.      item minus the number of bits set by the `high' code (*note
  590.      Constants::.).
  591.  
  592.      M should be `Pmode'.
  593.  
  594. `(minus:M X Y)'
  595.      Like `plus' but represents subtraction.
  596.  
  597. `(compare:M X Y)'
  598.      Represents the result of subtracting Y from X for purposes of
  599.      comparison.  The result is computed without overflow, as if with
  600.      infinite precision.
  601.  
  602.      Of course, machines can't really subtract with infinite precision.
  603.      However, they can pretend to do so when only the sign of the
  604.      result will be used, which is the case when the result is stored
  605.      in the condition code.   And that is the only way this kind of
  606.      expression may validly be used: as a value to be stored in the
  607.      condition codes.
  608.  
  609.      The mode M is not related to the modes of X and Y, but instead is
  610.      the mode of the condition code value.  If `(cc0)' is used, it is
  611.      `VOIDmode'.  Otherwise it is some mode in class `MODE_CC', often
  612.      `CCmode'.  *Note Condition Code::.
  613.  
  614.      Normally, X and Y must have the same mode.  Otherwise, `compare'
  615.      is valid only if the mode of X is in class `MODE_INT' and Y is a
  616.      `const_int' or `const_double' with mode `VOIDmode'.  The mode of X
  617.      determines what mode the comparison is to be done in; thus it must
  618.      not be `VOIDmode'.
  619.  
  620.      If one of the operands is a constant, it should be placed in the
  621.      second operand and the comparison code adjusted as appropriate.
  622.  
  623.      A `compare' specifying two `VOIDmode' constants is not valid since
  624.      there is no way to know in what mode the comparison is to be
  625.      performed; the comparison must either be folded during the
  626.      compilation or the first operand must be loaded into a register
  627.      while its mode is still known.
  628.  
  629. `(neg:M X)'
  630.      Represents the negation (subtraction from zero) of the value
  631.      represented by X, carried out in mode M.
  632.  
  633. `(mult:M X Y)'
  634.      Represents the signed product of the values represented by X and Y
  635.      carried out in machine mode M.
  636.  
  637.      Some machines support a multiplication that generates a product
  638.      wider than the operands.  Write the pattern for this as
  639.  
  640.           (mult:M (sign_extend:M X) (sign_extend:M Y))
  641.  
  642.      where M is wider than the modes of X and Y, which need not be the
  643.      same.
  644.  
  645.      Write patterns for unsigned widening multiplication similarly using
  646.      `zero_extend'.
  647.  
  648. `(div:M X Y)'
  649.      Represents the quotient in signed division of X by Y, carried out
  650.      in machine mode M.  If M is a floating point mode, it represents
  651.      the exact quotient; otherwise, the integerized quotient.
  652.  
  653.      Some machines have division instructions in which the operands and
  654.      quotient widths are not all the same; you should represent such
  655.      instructions using `truncate' and `sign_extend' as in,
  656.  
  657.           (truncate:M1 (div:M2 X (sign_extend:M2 Y)))
  658.  
  659. `(udiv:M X Y)'
  660.      Like `div' but represents unsigned division.
  661.  
  662. `(mod:M X Y)'
  663. `(umod:M X Y)'
  664.      Like `div' and `udiv' but represent the remainder instead of the
  665.      quotient.
  666.  
  667. `(smin:M X Y)'
  668. `(smax:M X Y)'
  669.      Represents the smaller (for `smin') or larger (for `smax') of X
  670.      and Y, interpreted as signed integers in mode M.
  671.  
  672. `(umin:M X Y)'
  673. `(umax:M X Y)'
  674.      Like `smin' and `smax', but the values are interpreted as unsigned
  675.      integers.
  676.  
  677. `(not:M X)'
  678.      Represents the bitwise complement of the value represented by X,
  679.      carried out in mode M, which must be a fixed-point machine mode.
  680.  
  681. `(and:M X Y)'
  682.      Represents the bitwise logical-and of the values represented by X
  683.      and Y, carried out in machine mode M, which must be a fixed-point
  684.      machine mode.
  685.  
  686. `(ior:M X Y)'
  687.      Represents the bitwise inclusive-or of the values represented by X
  688.      and Y, carried out in machine mode M, which must be a fixed-point
  689.      mode.
  690.  
  691. `(xor:M X Y)'
  692.      Represents the bitwise exclusive-or of the values represented by X
  693.      and Y, carried out in machine mode M, which must be a fixed-point
  694.      mode.
  695.  
  696. `(ashift:M X C)'
  697.      Represents the result of arithmetically shifting X left by C
  698.      places.  X have mode M, a fixed-point machine mode.  C be a
  699.      fixed-point mode or be a constant with mode `VOIDmode'; which mode
  700.      is determined by the mode called for in the machine description
  701.      entry for the left-shift instruction.  For example, on the Vax,
  702.      the mode of C is `QImode' regardless of M.
  703.  
  704. `(lshift:M X C)'
  705.      Like `ashift' but for logical left shift.  `ashift' and `lshift'
  706.      are identical operations; we customarily use `ashift' for both.
  707.  
  708. `(lshiftrt:M X C)'
  709. `(ashiftrt:M X C)'
  710.      Like `lshift' and `ashift' but for right shift.  Unlike the case
  711.      for left shift, these two operations are distinct.
  712.  
  713. `(rotate:M X C)'
  714. `(rotatert:M X C)'
  715.      Similar but represent left and right rotate.  If C is a constant,
  716.      use `rotate'.
  717.  
  718. `(abs:M X)'
  719.      Represents the absolute value of X, computed in mode M.
  720.  
  721. `(sqrt:M X)'
  722.      Represents the square root of X, computed in mode M.  Most often M
  723.      will be a floating point mode.
  724.  
  725. `(ffs:M X)'
  726.      Represents one plus the index of the least significant 1-bit in X,
  727.      represented as an integer of mode M.  (The value is zero if X is
  728.      zero.)  The mode of X need not be M; depending on the target
  729.      machine, various mode combinations may be valid.
  730.  
  731. File: gcc.info,  Node: Comparisons,  Next: Bit Fields,  Prev: Arithmetic,  Up: RTL
  732.  
  733. Comparison Operations
  734. =====================
  735.  
  736.    Comparison operators test a relation on two operands and are
  737. considered to represent a machine-dependent nonzero value described by,
  738. but not necessarily equal to, `STORE_FLAG_VALUE' (*note Misc::.) if the
  739. relation holds, or zero if it does not.  The mode of the comparison
  740. operation is independent of the mode of the data being compared.  If
  741. the comparison operation is being tested (e.g., the first operand of an
  742. `if_then_else'), the mode must be `VOIDmode'.  If the comparison
  743. operation is producing data to be stored in some variable, the mode
  744. must be in class `MODE_INT'.  All comparison operations producing data
  745. must use the same mode, which is machine-specific.
  746.  
  747.    There are two ways that comparison operations may be used.  The
  748. comparison operators may be used to compare the condition codes `(cc0)'
  749. against zero, as in `(eq (cc0) (const_int 0))'.  Such a construct
  750. actually refers to the result of the preceding instruction in which the
  751. condition codes were set.  The instructing setting the condition code
  752. must be adjacent to the instruction using the condition code; only
  753. `note' insns may separate them.
  754.  
  755.    Alternatively, a comparison operation may directly compare two data
  756. objects.  The mode of the comparison is determined by the operands; they
  757. must both be valid for a common machine mode.  A comparison with both
  758. operands constant would be invalid as the machine mode could not be
  759. deduced from it, but such a comparison should never exist in RTL due to
  760. constant folding.
  761.  
  762.    In the example above, if `(cc0)' were last set to `(compare X Y)',
  763. the comparison operation is identical to `(eq X Y)'.  Usually only one
  764. style of comparisons is supported on a particular machine, but the
  765. combine pass will try to merge the operations to produce the `eq' shown
  766. in case it exists in the context of the particular insn involved.
  767.  
  768.    Inequality comparisons come in two flavors, signed and unsigned.
  769. Thus, there are distinct expression codes `gt' and `gtu' for signed and
  770. unsigned greater-than.  These can produce different results for the same
  771. pair of integer values: for example, 1 is signed greater-than -1 but not
  772. unsigned greater-than, because -1 when regarded as unsigned is actually
  773. `0xffffffff' which is greater than 1.
  774.  
  775.    The signed comparisons are also used for floating point values.
  776. Floating point comparisons are distinguished by the machine modes of
  777. the operands.
  778.  
  779. `(eq:M X Y)'
  780.      1 if the values represented by X and Y are equal, otherwise 0.
  781.  
  782. `(ne:M X Y)'
  783.      1 if the values represented by X and Y are not equal, otherwise 0.
  784.  
  785. `(gt:M X Y)'
  786.      1 if the X is greater than Y.  If they are fixed-point, the
  787.      comparison is done in a signed sense.
  788.  
  789. `(gtu:M X Y)'
  790.      Like `gt' but does unsigned comparison, on fixed-point numbers
  791.      only.
  792.  
  793. `(lt:M X Y)'
  794. `(ltu:M X Y)'
  795.      Like `gt' and `gtu' but test for "less than".
  796.  
  797. `(ge:M X Y)'
  798. `(geu:M X Y)'
  799.      Like `gt' and `gtu' but test for "greater than or equal".
  800.  
  801. `(le:M X Y)'
  802. `(leu:M X Y)'
  803.      Like `gt' and `gtu' but test for "less than or equal".
  804.  
  805. `(if_then_else COND THEN ELSE)'
  806.      This is not a comparison operation but is listed here because it is
  807.      always used in conjunction with a comparison operation.  To be
  808.      precise, COND is a comparison expression.  This expression
  809.      represents a choice, according to COND, between the value
  810.      represented by THEN and the one represented by ELSE.
  811.  
  812.      On most machines, `if_then_else' expressions are valid only to
  813.      express conditional jumps.
  814.  
  815. `(cond [TEST1 VALUE1 TEST2 VALUE2 ...] DEFAULT)'
  816.      Similar to `if_then_else', but more general.  Each of TEST1,
  817.      TEST2, ... is performed in turn.  The result of this expression is
  818.      the VALUE corresponding to the first non-zero test, or DEFAULT if
  819.      none of the tests are non-zero expressions.
  820.  
  821.      This is currently not valid for instruction patterns and is
  822.      supported only for insn attributes.  *Note Insn Attributes::.
  823.  
  824. File: gcc.info,  Node: Bit Fields,  Next: Conversions,  Prev: Comparisons,  Up: RTL
  825.  
  826. Bit Fields
  827. ==========
  828.  
  829.    Special expression codes exist to represent bit-field instructions.
  830. These types of expressions are lvalues in RTL; they may appear on the
  831. left side of an assignment, indicating insertion of a value into the
  832. specified bit field.
  833.  
  834. `(sign_extract:M LOC SIZE POS)'
  835.      This represents a reference to a sign-extended bit field contained
  836.      or starting in LOC (a memory or register reference).  The bit field
  837.      is SIZE bits wide and starts at bit POS.  The compilation option
  838.      `BITS_BIG_ENDIAN' says which end of the memory unit POS counts
  839.      from.
  840.  
  841.      If LOC is in memory, its mode must be a single-byte integer mode.
  842.      If LOC is in a register, the mode to use is specified by the
  843.      operand of the `insv' or `extv' pattern (*note Standard Names::.)
  844.      and is usually a full-word integer mode.
  845.  
  846.      The mode of POS is machine-specific and is also specified in the
  847.      `insv' or `extv' pattern.
  848.  
  849.      The mode M is the same as the mode that would be used for LOC if
  850.      it were a register.
  851.  
  852. `(zero_extract:M LOC SIZE POS)'
  853.      Like `sign_extract' but refers to an unsigned or zero-extended bit
  854.      field.  The same sequence of bits are extracted, but they are
  855.      filled to an entire word with zeros instead of by sign-extension.
  856.  
  857. File: gcc.info,  Node: Conversions,  Next: RTL Declarations,  Prev: Bit Fields,  Up: RTL
  858.  
  859. Conversions
  860. ===========
  861.  
  862.    All conversions between machine modes must be represented by
  863. explicit conversion operations.  For example, an expression which is
  864. the sum of a byte and a full word cannot be written as `(plus:SI
  865. (reg:QI 34) (reg:SI 80))' because the `plus' operation requires two
  866. operands of the same machine mode.  Therefore, the byte-sized operand
  867. is enclosed in a conversion operation, as in
  868.  
  869.      (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
  870.  
  871.    The conversion operation is not a mere placeholder, because there
  872. may be more than one way of converting from a given starting mode to
  873. the desired final mode.  The conversion operation code says how to do
  874. it.
  875.  
  876.    For all conversion operations, X must not be `VOIDmode' because the
  877. mode in which to do the conversion would not be known.  The conversion
  878. must either be done at compile-time or X must be placed into a register.
  879.  
  880. `(sign_extend:M X)'
  881.      Represents the result of sign-extending the value X to machine
  882.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  883.      a mode narrower than M.
  884.  
  885. `(zero_extend:M X)'
  886.      Represents the result of zero-extending the value X to machine
  887.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  888.      a mode narrower than M.
  889.  
  890. `(float_extend:M X)'
  891.      Represents the result of extending the value X to machine mode M.
  892.      m must be a floating point mode and X a floating point value of a
  893.      mode narrower than M.
  894.  
  895. `(truncate:M X)'
  896.      Represents the result of truncating the value X to machine mode M.
  897.      M must be a fixed-point mode and X a fixed-point value of a mode
  898.      wider than M.
  899.  
  900. `(float_truncate:M X)'
  901.      Represents the result of truncating the value X to machine mode M.
  902.      M must be a floating point mode and X a floating point value of a
  903.      mode wider than M.
  904.  
  905. `(float:M X)'
  906.      Represents the result of converting fixed point value X, regarded
  907.      as signed, to floating point mode M.
  908.  
  909. `(unsigned_float:M X)'
  910.      Represents the result of converting fixed point value X, regarded
  911.      as unsigned, to floating point mode M.
  912.  
  913. `(fix:M X)'
  914.      When M is a fixed point mode, represents the result of converting
  915.      floating point value X to mode M, regarded as signed.  How
  916.      rounding is done is not specified, so this operation may be used
  917.      validly in compiling C code only for integer-valued operands.
  918.  
  919. `(unsigned_fix:M X)'
  920.      Represents the result of converting floating point value X to
  921.      fixed point mode M, regarded as unsigned.  How rounding is done is
  922.      not specified.
  923.  
  924. `(fix:M X)'
  925.      When M is a floating point mode, represents the result of
  926.      converting floating point value X (valid for mode M) to an
  927.      integer, still represented in floating point mode M, by rounding
  928.      towards zero.
  929.  
  930. File: gcc.info,  Node: RTL Declarations,  Next: Side Effects,  Prev: Conversions,  Up: RTL
  931.  
  932. Declarations
  933. ============
  934.  
  935.    Declaration expression codes do not represent arithmetic operations
  936. but rather state assertions about their operands.
  937.  
  938. `(strict_low_part (subreg:M (reg:N R) 0))'
  939.      This expression code is used in only one context: as the
  940.      destination operand of a `set' expression.  In addition, the
  941.      operand of this expression must be a non-paradoxical `subreg'
  942.      expression.
  943.  
  944.      The presence of `strict_low_part' says that the part of the
  945.      register which is meaningful in mode N, but is not part of mode M,
  946.      is not to be altered.  Normally, an assignment to such a subreg is
  947.      allowed to have undefined effects on the rest of the register when
  948.      M is less than a word.
  949.  
  950. ə